<template>
  <div class="Items-head">
    <van-nav-bar :title="title"
                 right-text="按钮"
                 left-arrow
                 @click-left="toFromAny"
                 @click-right="onClickRight" />
  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      required: true
    }
  },
  methods: {
    onClickRight () { },
    toFromAny () {
      const boforeFrom = localStorage.getItem('boforeFrom')
      const from = localStorage.getItem('from')
      if (boforeFrom === '/contlist' && from === '/confirmorder') {
        this.$router.push('/cart')
      } else if (boforeFrom === '/addcont' && from === '/contlist') {
        this.$router.push('/cart')
      } else {
        this.$router.go(-1)
      }
    }
  }

}
</script>

<style lang="scss" scoped>
.Items-head {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  /deep/ .van-icon {
    font-size: 22px;
    color: #666;
  }
}
</style>
